﻿@model IEnumerable<TestHttpModules.Product>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function addFun(id) {
        $("#Comment").show();
        $("#ProductID").val(id);
    }
</script>
<table>
    <tr>
        <th>
        </th>
        <th>
            UserID
        </th>
        <th>
            Name
        </th>
        <th>
            Price
        </th>
        <th>
            Info
        </th>
        <th>
            Status
        </th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
                @Html.ActionLink("Details", "Details", new { id = item.ID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.ID })
                <a href="javascript:addFun(@item.ID)">评论</a>
            </td>
            <td>
                @item.UserID
            </td>
            <td>
                @item.Name
            </td>
            <td>
                @String.Format("{0:F}", item.Price)
            </td>
            <td>
                @item.Info
            </td>
            <td>
                @item.Status
            </td>
        </tr>
           if (item.Product_Comment != null && item.Product_Comment.Count() > 0)
           {
               foreach (var p in item.Product_Comment)
               {
        <tr>
            <td>
                @Html.ActionLink("Delete", "ProductCommentDelete", new { id = p.ID })
            </td>
            <td colspan="5">
                評論相關：@p.CommentTitle<br />@p.CommentInfo
            </td>
        </tr>
                    
               }
           }
    }
</table>
